package com.zzl.study.nacos.config;

import com.zzl.study.nacos.condition.ConditionalOnNacosMultiDiscoveryEnabled;
import com.zzl.study.nacos.utils.InetIPv6Utils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.client.ConditionalOnDiscoveryEnabled;
import org.springframework.cloud.commons.util.InetUtilsProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 网络工具自动配置类
 *
 * @author: zhangzl
 * @date: 2025/7/15 9:43
 * @version: 1.0
 */
@Configuration(proxyBeanMethods = false)
@ConditionalOnDiscoveryEnabled
@ConditionalOnNacosMultiDiscoveryEnabled
public class InetAutoConfiguration {

    /**
     * 向Spring容器注入一个InetIPv6Utils对象
     *
     * @param properties 网络工具属性配置
     * @return InetIPv6Utils对象
     */
    @Bean
    @ConditionalOnMissingBean
    public InetIPv6Utils inetIPv6Utils(InetUtilsProperties properties) {
        return new InetIPv6Utils(properties);
    }

}
